#!/bin/bash
# /etc/init.d/pysmarthouse_service

### BEGIN INIT INFO
# Provides:          pysmarthouse_service
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Smart house control by Python 3
# Description:       This service is used to control house applications.
### END INIT INFO


case "$1" in 
    start)
        echo "Starting pysmarthouse_service"
        /home/pi/git/pysmarthouse/pysmarthouse.sh
        ;;
    stop)
        echo "Stopping pysmarthouse_service"
        killall python3
        ;;
    *)
        echo "Usage: /etc/init.d/pysmarthouse_service start|stop"
        exit 1
        ;;
esac

exit 0
